Profiling images can now be generated from crossbuild images#5834
Profiling images can now be generated from crossbuild images#5834marc-casavant wants to merge 2 commits into
Conversation
21643c9 to
64edef6
Compare
f8f3881 to
ff45c05
Compare
c52eb04 to
7295e39
Compare
83477ce to
a16694f
Compare
|
@claude review in regards to the last 20 commits in master, and suggest fixes |
|
Claude finished @arr2036's task in 5m 59s —— View job Review
Reviewed Critical1. 2. The makefile rules are emitted for every distro, but the m4 is Ubuntu-only.
3. PR doesn't use the new shared m4 snippets. Master commit Significant4. 5. Generated header points at a non-existent make target. 6. 7. 8. Inconsistent image-prefix naming. Base uses Minor / nits9. Image bloat. 10. Non-reproducible clones. 11. 12. Stamp name uses mixed separators. 13. No CI workflow consumes these targets. This matches @alandekok's "developer convenience" intent (per the discussion on the help text), but it's worth confirming explicitly. If profiling images are ever wired into CI, follow the Review-comment statusThe thread cleanup from earlier rounds looks resolved:
|
| # | ||
| # Build the profiling image | ||
| # | ||
| crossbuild.${1}.profile.build: $(DD)/stamp-image.${1}-profile.build | ||
|
|
||
| $(DD)/stamp-image.${1}-profile.build: $(DT)/${1}/Dockerfile.prof | ||
| ${Q}echo "BUILD ${1} (freeradius4-$(PROFILE)/${1}) > $(DD)/build.${1}-profile.build" | ||
| ${Q}docker build $(DOCKER_BUILD_OPTS) . \ | ||
| -f $(DT)/${1}/Dockerfile.prof \ | ||
| -t freeradius4-$(PROFILE)/${1} \ |
There was a problem hiding this comment.
🔴 The new crossbuild.IMAGE.profile.build rule only depends on Dockerfile.prof, not on the base crossbuild image stamp $(DD)/stamp-image.${1}. Since Dockerfile.prof starts with FROM freeradius40x-build/<distro> (a local-only image tag), running make crossbuild.ubuntu24.profile.build on a clean checkout fails because docker tries to pull the non-existent image from a remote registry. Add $(DD)/stamp-image.${1} as a prerequisite of $(DD)/stamp-image.${1}-profile.build so the base image is built first.
Extended reasoning...
What the bug is
The rule introduced at scripts/docker/crossbuild.mk:160:
$(DD)/stamp-image.${1}-profile.build: $(DT)/${1}/Dockerfile.prof
${Q}echo "BUILD ${1} (freeradius4-$(PROFILE)/${1}) > $(DD)/build.${1}-profile.build"
${Q}docker build $(DOCKER_BUILD_OPTS) . \
-f $(DT)/${1}/Dockerfile.prof \
-t freeradius4-$(PROFILE)/${1} \
>$(DD)/build.${1}-profile.build 2>&1
${Q}touch $(DD)/stamp-image.${1}-profile.builddeclares only $(DT)/${1}/Dockerfile.prof as a prerequisite. However, the generated Dockerfile.prof (see scripts/docker/build/ubuntu24/Dockerfile.prof:6-7 and scripts/docker/m4/profiling.deb.m4:1-2) begins with:
ARG from=freeradius40x-build/ubuntu24
FROM ${from}This is a local-only image tag, produced by the $(DD)/stamp-image.${1} rule. The docker build invocation passes no --build-arg to override from, so docker will look for freeradius40x-build/ubuntu24 locally and, on a clean checkout where this image has not been built, fall through to a registry pull which fails (e.g. pull access denied for freeradius40x-build/ubuntu24).
Why existing rules don't prevent it
Compare with the sibling docker.up.${1} rule a few lines below (around line 174):
$(DD)/docker.up.${1}: $(DD)/stamp-image.${1}That rule correctly chains on the base image stamp, ensuring the base image is built first. The new profile.build rule simply omits this prerequisite.
Impact
The PR description explicitly advertises make crossbuild.ubuntu24.profile.build as a user-facing workflow, and it is listed in crossbuild.help at line 97. A developer following the PR description on a fresh checkout will hit a confusing failure because docker reports a pull error for what appears to be a local image name, rather than a clear "base image not built yet" message. CI is unaffected because it already runs the base crossbuild step first.
Step-by-step proof
- Fresh checkout of this branch —
scripts/docker/crossbuild/stamp-image.ubuntu24does not exist and the docker imagefreeradius40x-build/ubuntu24is not present in the local docker daemon. - Run
make crossbuild.ubuntu24.profile.build. - Make resolves:
crossbuild.ubuntu24.profile.build→$(DD)/stamp-image.ubuntu24-profile.build. - The only prerequisite is
$(DT)/ubuntu24/Dockerfile.prof, which already exists in the tree, so make proceeds directly to the docker build recipe. docker build -f scripts/docker/build/ubuntu24/Dockerfile.prof -t freeradius4-default-profiling/ubuntu24 .is invoked.- Docker parses
FROM ${from}withfrom=freeradius40x-build/ubuntu24. No local image with that tag exists, so docker attempts a registry pull. - The pull fails with
pull access denied for freeradius40x-build/ubuntu24, repository does not exist or may require 'docker login'. The build aborts andbuild.ubuntu24-profile.buildrecords the failure.
Fix
Add $(DD)/stamp-image.${1} as a prerequisite of the profile build stamp:
$(DD)/stamp-image.${1}-profile.build: $(DD)/stamp-image.${1} $(DT)/${1}/Dockerfile.profThis matches the convention used by $(DD)/docker.up.${1} and ensures the base crossbuild image exists before docker tries to consume it as the FROM of the profiling image.
There was a problem hiding this comment.
Added
f652b8d to
f5b7e8b
Compare
|
I've merged a set of changes derived from these, but with the duplication removed. There are now common macros which handled rendering docker files, and image lifecycles. These are the new targets: |
|
There's also |
Main changes:
FROM <CROSSBULD_IMAGE>Remove stamp:
make crossbuild.ubuntu24.profile.resetGenerate the profiling Dockerfile.prof:
make crossbuild.ubuntu24.profile.regenBuild the profiling image:
make crossbuild.ubuntu24.profile.build